from typing import Optional

from fastapi import Query

from app.core.base_response import BaseResponse
from app.service import barrage_service
from app.validator.model import  Barrage


async def get_barrage_list(*,id: Optional[str] = Query(None, min_length=3, max_length=50)):
    data = await barrage_service.read_list(id)
    return BaseResponse.success(data=data)

async def create_barrage(*, id: Optional[str] = Query(None, min_length=3, max_length=50),
                         model: Barrage,):
    data = await barrage_service.create(id,model)
    return BaseResponse.success(data=data)

async def create_barrage_many():
    data = await barrage_service.create_many()
    return BaseResponse.success(data=data)